package com.testDemo.hutool;

import cn.hutool.core.date.LocalDateTimeUtil;
import cn.hutool.core.text.StrPool;
import cn.hutool.core.util.StrUtil;
import org.junit.jupiter.api.Test;

import java.util.List;

/**
 * @author: zouren
 * @date: 2021/12/9
 * @description:
 */
public class StrutilTest {

    @Test
    public void upperFirst() {
        System.out.println(StrUtil.upperFirst("abc"));

    }

    @Test
    public void subAfter() {
        String s = StrUtil.subAfter("c.s.i.r.c.IpResourceController.getResourceDetail  param:[{\"id\":\"1719980187764494338\",\"resourceTypeCode\":\"PDT202311011645342736744263\"}]", "param:", true);
        System.out.println(s);

        System.out.println(StrUtil.subAfter("asdf.pdf",".",false));

    }
    @Test
    public void subBefore() {
        String s = StrUtil.subBefore("LHL_POLICY_SNAPSHOT1_PAS_UAT&PRD_DDL.sql", ".sql", true);
        System.out.println(s);
        List<String> split = StrUtil.split(s, "_");

        String test = StrUtil.subBefore("c:/temp/aaa/test", "/", true);
        System.out.println(test);


    }
    @Test
    public void subAfter2() {
        String s = StrUtil.subAfter("sadfsa/aaaa/ccc/bbb.html", "/", true);

        System.out.println(s);

        s = StrUtil.subAfter(".aas-iuat.hkmca.hk/pas/usermission/CommonPool.jsp", "pas", true);
        System.out.println(s);

        s = StrUtil.subAfter("/pas1/usermission/CommonPool.jsp", "pas", true);
        System.out.println(s);
    }
    @Test
    public void aa() {
        String str = "test";

        System.out.println( StrUtil.sub(str, 0, 6));
    }
    @Test
    public void subSuf() {

        System.out.println(  StrUtil.subSuf("test",-2));//st
        System.out.println(  StrUtil.subSuf("01",-2));//01
        System.out.println(  StrUtil.subSuf("012",-2));//12
        System.out.println(  StrUtil.subSuf("1234456",-2));//56
        System.out.println(  StrUtil.sub("1234456",0,4000));//123456
        System.out.println(  StrUtil.sub("1234456",0,4000).length());//7
    }
    @Test
    public void join() {
        System.out.println(   StrUtil.join(StrPool.COMMA,"a", "c"));

    }

}
